<template>
<div class="home-box" style="margin-left:20px;">
    <el-form :inline="true" :model="searchForm">
      <el-form-item label="员工姓名">
        <el-input
          v-model="searchForm.empName"
          placeholder="员工姓名"
          clearable
        ></el-input>
      </el-form-item>
      <el-form-item label="岗位名称">
        <el-input
          v-model="searchForm.position"
          placeholder="岗位名称"
          clearable
        ></el-input>
      </el-form-item>
      <el-form-item label="部门名称">
        <el-input
          v-model="searchForm.dept"
          placeholder="岗位名称"
          clearable
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="searchEvent" type="primary">查询 </el-button>
      </el-form-item>
      <el-form-item>
        <el-button @click="update" type="primary">重置 </el-button>
      </el-form-item>
      <el-form-item >
        <el-tooltip class="item" effect="dark" content="刷新" placement="top">
          <el-button circle icon="Refresh" @click="update" />
        </el-tooltip>
      </el-form-item>
    </el-form>
  </div>
  <el-table
    :data="PositionList"
    style="width: 100%; margin: 5px; border-radius: 5px;box-shadow: 5px 5px 10px rgba(51, 126, 204, 0.5)"
    size="large"
    :header-cell-style="{
      background: '#626aef !important',
      color: '#ffffff',
      border: 'none !important',
    }"
  >
    <el-table-column
      prop="empName"
      label="员工姓名"
      width="75"
    >
    </el-table-column>
    <el-table-column prop="position" label="岗位" width="85" />
    <el-table-column prop="deptName" label="所属部门" width="85" />
    <el-table-column prop="items" label="进度" direction="vertical">
        <template #default="scope">
        <el-steps :active="scope.row.orderStatus" finish-status="success" class="step" space="350px" >
            <el-step :title="item.title" :description="item.description" v-for="(item,index) in scope.row.items" :key="index">
            </el-step>
        </el-steps>
        </template>
    </el-table-column>
  </el-table>
  <div></div>
</template>


<script setup>
import { ref, onMounted, onBeforeMount, reactive, watch } from "vue";
import { Timer } from "@element-plus/icons-vue";
import { useRouter } from "vue-router";
import { getProgress,searchProgress} from "@/api/progress";
import { ElMessage } from "element-plus";

const searchForm = ref({
  position: "",
  empName:"",
  dept:""
});
const PositionList = ref([]);
onBeforeMount(() => {
  getProgress().then((data) => {
    PositionList.value = data.data;
    console.log(PositionList.value);
  });
});
watch(
  PositionList,
  (newVal) => {
    console.log("list发生了改变");
  },
  { deep: true }
);

const searchEvent = () => {
  searchProgress(searchForm.value).then((data) => {
    PositionList.value = data.data;
  });
};

const update = () => {
  searchForm.value.position = "";
  searchForm.value.dept = "";
  searchForm.value.empName = "";
  getProgress().then((data) => {
    PositionList.value = data.data;
  });
};
</script>

<style lang="scss" scoped>
:deep(.my-content) {
  background: rgba(98, 106, 239,0.2)!important;
  font-size: 15px;
}
.pagination {
  margin: 20px 50px;
  display: flex;
  justify-content: end;
}
::v-deep .el-step__head.is-process {
  color: rgb(52, 158, 250);
  border-color: rgb(52, 158, 250);
}
::v-deep .el-step__title.is-process {
    font-weight: bold;
    color: rgb(52, 158, 250);
}
::v-deep .el-step__description.is-process {
    color: rgb(52, 158, 250);
}
.multiline-description .el-step__description {
  white-space: pre-line; /* 或者使用 normal; */
}
</style>
